<html>
<head>
<script type="text/javascript" src="http://localhost:8080/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

<script>
	var socket = io.connect('http://localhost:8080');
	var user;
	
	socket.on('loginsucces', function (userdata) {
		console.log(userdata);		
		user = userdata;
	});
	
	socket.on('loginfailed', function () {
		$("#message").val('Login failed');
	});
	
	socket.on('user_joined', function (data) {
		console.log(data);
		$("#message").val(data);
	});	

	function login() {
		socket.emit('login', { username: $("#username").val(), password: $("#password").val() });
	}	
</script>
</head>
<body>
	<div id="login">
		<input title="Username" id="username" type="text" maxlength="12" value="unnown" /><br />
		<input title="Password" id="password" type="password" maxlength="8" value="az61tl" /><br />
		<button type="button" onclick="login();">Login</button> 	
		<p id="message"></p>
	</div>	
</body>
</html>